// Copyright 2023 Dolthub, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package output

import "testing"

func TestAlterView(t *testing.T) {
	tests := []QueryParses{
		Parses("ALTER VIEW name ALTER column_name SET DEFAULT expression"),
		Parses("ALTER VIEW IF EXISTS name ALTER column_name SET DEFAULT expression"),
		Parses("ALTER VIEW name ALTER COLUMN column_name SET DEFAULT expression"),
		Parses("ALTER VIEW IF EXISTS name ALTER COLUMN column_name SET DEFAULT expression"),
		Parses("ALTER VIEW name ALTER column_name DROP DEFAULT"),
		Parses("ALTER VIEW IF EXISTS name ALTER column_name DROP DEFAULT"),
		Parses("ALTER VIEW name ALTER COLUMN column_name DROP DEFAULT"),
		Parses("ALTER VIEW IF EXISTS name ALTER COLUMN column_name DROP DEFAULT"),
		Converts("ALTER VIEW name OWNER TO new_owner"),
		Converts("ALTER VIEW IF EXISTS name OWNER TO new_owner"),
		Converts("ALTER VIEW name OWNER TO CURRENT_ROLE"),
		Converts("ALTER VIEW IF EXISTS name OWNER TO CURRENT_ROLE"),
		Converts("ALTER VIEW name OWNER TO CURRENT_USER"),
		Converts("ALTER VIEW IF EXISTS name OWNER TO CURRENT_USER"),
		Converts("ALTER VIEW name OWNER TO SESSION_USER"),
		Converts("ALTER VIEW IF EXISTS name OWNER TO SESSION_USER"),
		Parses("ALTER VIEW name RENAME column_name TO new_column_name"),
		Parses("ALTER VIEW IF EXISTS name RENAME column_name TO new_column_name"),
		Parses("ALTER VIEW name RENAME COLUMN column_name TO new_column_name"),
		Parses("ALTER VIEW IF EXISTS name RENAME COLUMN column_name TO new_column_name"),
		Parses("ALTER VIEW name RENAME TO new_name"),
		Parses("ALTER VIEW IF EXISTS name RENAME TO new_name"),
		Parses("ALTER VIEW name SET SCHEMA new_schema"),
		Parses("ALTER VIEW IF EXISTS name SET SCHEMA new_schema"),
		Parses("ALTER VIEW name SET ( check_option )"),
		Parses("ALTER VIEW IF EXISTS name SET ( check_option )"),
		Parses("ALTER VIEW name SET ( check_option = 'str' )"),
		Parses("ALTER VIEW IF EXISTS name SET ( check_option = 'str' )"),
		Parses("ALTER VIEW name SET ( security_barrier )"),
		Parses("ALTER VIEW IF EXISTS name SET ( security_barrier )"),
		Parses("ALTER VIEW name SET ( security_barrier = true )"),
		Parses("ALTER VIEW IF EXISTS name SET ( security_barrier = true )"),
		Parses("ALTER VIEW name SET ( security_invoker )"),
		Parses("ALTER VIEW IF EXISTS name SET ( security_invoker )"),
		Parses("ALTER VIEW name SET ( security_invoker = true )"),
		Parses("ALTER VIEW IF EXISTS name SET ( security_invoker = true )"),
		Parses("ALTER VIEW name SET ( check_option , check_option )"),
		Parses("ALTER VIEW IF EXISTS name SET ( check_option , check_option )"),
		Parses("ALTER VIEW name SET ( check_option = 'str' , check_option )"),
		Parses("ALTER VIEW IF EXISTS name SET ( check_option = 'str' , check_option )"),
		Parses("ALTER VIEW name SET ( security_barrier , check_option )"),
		Parses("ALTER VIEW IF EXISTS name SET ( security_barrier , check_option )"),
		Parses("ALTER VIEW name SET ( security_barrier = true , check_option )"),
		Parses("ALTER VIEW IF EXISTS name SET ( security_barrier = true , check_option )"),
		Parses("ALTER VIEW name SET ( security_invoker , check_option )"),
		Parses("ALTER VIEW IF EXISTS name SET ( security_invoker , check_option )"),
		Parses("ALTER VIEW name SET ( security_invoker = true , check_option )"),
		Parses("ALTER VIEW IF EXISTS name SET ( security_invoker = true , check_option )"),
		Parses("ALTER VIEW name SET ( check_option , check_option = 'str' )"),
		Parses("ALTER VIEW IF EXISTS name SET ( check_option , check_option = 'str' )"),
		Parses("ALTER VIEW name SET ( check_option = 'str' , check_option = 'str' )"),
		Parses("ALTER VIEW IF EXISTS name SET ( check_option = 'str' , check_option = 'str' )"),
		Parses("ALTER VIEW name SET ( security_barrier , check_option = 'str' )"),
		Parses("ALTER VIEW IF EXISTS name SET ( security_barrier , check_option = 'str' )"),
		Parses("ALTER VIEW name SET ( security_barrier = true , check_option = 'str' )"),
		Parses("ALTER VIEW IF EXISTS name SET ( security_barrier = true , check_option = 'str' )"),
		Parses("ALTER VIEW name SET ( security_invoker , check_option = 'str' )"),
		Parses("ALTER VIEW IF EXISTS name SET ( security_invoker , check_option = 'str' )"),
		Parses("ALTER VIEW name SET ( security_invoker = true , check_option = 'str' )"),
		Parses("ALTER VIEW IF EXISTS name SET ( security_invoker = true , check_option = 'str' )"),
		Parses("ALTER VIEW name SET ( check_option , security_barrier )"),
		Parses("ALTER VIEW IF EXISTS name SET ( check_option , security_barrier )"),
		Parses("ALTER VIEW name SET ( check_option = 'str' , security_barrier )"),
		Parses("ALTER VIEW IF EXISTS name SET ( check_option = 'str' , security_barrier )"),
		Parses("ALTER VIEW name SET ( security_barrier , security_barrier )"),
		Parses("ALTER VIEW IF EXISTS name SET ( security_barrier , security_barrier )"),
		Parses("ALTER VIEW name SET ( security_barrier = true , security_barrier )"),
		Parses("ALTER VIEW IF EXISTS name SET ( security_barrier = true , security_barrier )"),
		Parses("ALTER VIEW name SET ( security_invoker , security_barrier )"),
		Parses("ALTER VIEW IF EXISTS name SET ( security_invoker , security_barrier )"),
		Parses("ALTER VIEW name SET ( security_invoker = true , security_barrier )"),
		Parses("ALTER VIEW IF EXISTS name SET ( security_invoker = true , security_barrier )"),
		Parses("ALTER VIEW name SET ( check_option , security_barrier = true )"),
		Parses("ALTER VIEW IF EXISTS name SET ( check_option , security_barrier = true )"),
		Parses("ALTER VIEW name SET ( check_option = 'str' , security_barrier = true )"),
		Parses("ALTER VIEW IF EXISTS name SET ( check_option = 'str' , security_barrier = true )"),
		Parses("ALTER VIEW name SET ( security_barrier , security_barrier = true )"),
		Parses("ALTER VIEW IF EXISTS name SET ( security_barrier , security_barrier = true )"),
		Parses("ALTER VIEW name SET ( security_barrier = true , security_barrier = true )"),
		Parses("ALTER VIEW IF EXISTS name SET ( security_barrier = true , security_barrier = true )"),
		Parses("ALTER VIEW name SET ( security_invoker , security_barrier = true )"),
		Parses("ALTER VIEW IF EXISTS name SET ( security_invoker , security_barrier = true )"),
		Parses("ALTER VIEW name SET ( security_invoker = true , security_barrier = true )"),
		Parses("ALTER VIEW IF EXISTS name SET ( security_invoker = true , security_barrier = true )"),
		Parses("ALTER VIEW name SET ( check_option , security_invoker )"),
		Parses("ALTER VIEW IF EXISTS name SET ( check_option , security_invoker )"),
		Parses("ALTER VIEW name SET ( check_option = 'str' , security_invoker )"),
		Parses("ALTER VIEW IF EXISTS name SET ( check_option = 'str' , security_invoker )"),
		Parses("ALTER VIEW name SET ( security_barrier , security_invoker )"),
		Parses("ALTER VIEW IF EXISTS name SET ( security_barrier , security_invoker )"),
		Parses("ALTER VIEW name SET ( security_barrier = true , security_invoker )"),
		Parses("ALTER VIEW IF EXISTS name SET ( security_barrier = true , security_invoker )"),
		Parses("ALTER VIEW name SET ( security_invoker , security_invoker )"),
		Parses("ALTER VIEW IF EXISTS name SET ( security_invoker , security_invoker )"),
		Parses("ALTER VIEW name SET ( security_invoker = true , security_invoker )"),
		Parses("ALTER VIEW IF EXISTS name SET ( security_invoker = true , security_invoker )"),
		Parses("ALTER VIEW name SET ( check_option , security_invoker = true )"),
		Parses("ALTER VIEW IF EXISTS name SET ( check_option , security_invoker = true )"),
		Parses("ALTER VIEW name SET ( check_option = 'str' , security_invoker = true )"),
		Parses("ALTER VIEW IF EXISTS name SET ( check_option = 'str' , security_invoker = true )"),
		Parses("ALTER VIEW name SET ( security_barrier , security_invoker = true )"),
		Parses("ALTER VIEW IF EXISTS name SET ( security_barrier , security_invoker = true )"),
		Parses("ALTER VIEW name SET ( security_barrier = true , security_invoker = true )"),
		Parses("ALTER VIEW IF EXISTS name SET ( security_barrier = true , security_invoker = true )"),
		Parses("ALTER VIEW name SET ( security_invoker , security_invoker = true )"),
		Parses("ALTER VIEW IF EXISTS name SET ( security_invoker , security_invoker = true )"),
		Parses("ALTER VIEW name SET ( security_invoker = true , security_invoker = true )"),
		Parses("ALTER VIEW IF EXISTS name SET ( security_invoker = true , security_invoker = true )"),
		Parses("ALTER VIEW name RESET ( check_option )"),
		Parses("ALTER VIEW IF EXISTS name RESET ( check_option )"),
		Parses("ALTER VIEW name RESET ( security_barrier )"),
		Parses("ALTER VIEW IF EXISTS name RESET ( security_barrier )"),
		Parses("ALTER VIEW name RESET ( security_invoker )"),
		Parses("ALTER VIEW IF EXISTS name RESET ( security_invoker )"),
		Parses("ALTER VIEW name RESET ( check_option , check_option )"),
		Parses("ALTER VIEW IF EXISTS name RESET ( check_option , check_option )"),
		Parses("ALTER VIEW name RESET ( security_barrier , check_option )"),
		Parses("ALTER VIEW IF EXISTS name RESET ( security_barrier , check_option )"),
		Parses("ALTER VIEW name RESET ( security_invoker , check_option )"),
		Parses("ALTER VIEW IF EXISTS name RESET ( security_invoker , check_option )"),
		Parses("ALTER VIEW name RESET ( check_option , security_barrier )"),
		Parses("ALTER VIEW IF EXISTS name RESET ( check_option , security_barrier )"),
		Parses("ALTER VIEW name RESET ( security_barrier , security_barrier )"),
		Parses("ALTER VIEW IF EXISTS name RESET ( security_barrier , security_barrier )"),
		Parses("ALTER VIEW name RESET ( security_invoker , security_barrier )"),
		Parses("ALTER VIEW IF EXISTS name RESET ( security_invoker , security_barrier )"),
		Parses("ALTER VIEW name RESET ( check_option , security_invoker )"),
		Parses("ALTER VIEW IF EXISTS name RESET ( check_option , security_invoker )"),
		Parses("ALTER VIEW name RESET ( security_barrier , security_invoker )"),
		Parses("ALTER VIEW IF EXISTS name RESET ( security_barrier , security_invoker )"),
		Parses("ALTER VIEW name RESET ( security_invoker , security_invoker )"),
		Parses("ALTER VIEW IF EXISTS name RESET ( security_invoker , security_invoker )"),
	}

	RunTests(t, tests)
	// RewriteTests(t, tests, "alter_view_test.go")
}
